home *** CD-ROM | disk | FTP | other *** search
/ PC Graphics Unleashed / PC Graphics Unleashed.iso / ch17 / pi / roomfly / roomfly2.pi < prev    next >
Encoding:
Text File  |  1994-08-05  |  2.8 KB  |  145 lines

  1. // Scene File: ROOMFLY2.PI
  2. // Author: Rob McGregor
  3. //
  4. // Flying through a room among flying spheres and 
  5. // lights using cubic key frame interpolation...
  6.  
  7. // Define the range of the animation
  8. start_frame 0
  9. end_frame   62
  10. outfile     "room2"
  11.  
  12. directional_light <1, 5, -1>
  13. light <150, 5, -150>
  14.  
  15. if (frame == start_frame) {
  16.   include "..\..\..\colors.inc"
  17.   include "..\..\..\texture.inc"
  18.   include "..\..\..\stones.inc"
  19.   include "pedestal.inc"
  20.   include "picframe.inc"
  21.   include "campath.inc"
  22.   include "room.inc"
  23.   include "sphrpath.inc"  
  24.   include "spotpath.inc"  
  25.   include "..\venus\venus.inc"
  26. }
  27.  
  28. // Set up the key frames in an array
  29. define KF [0, 8, 17, 26, 35, 44, 53, 62]
  30.  
  31. // Assign the value of "frame" to variable "F"
  32. define F frame
  33.  
  34. // Determine what key frame sequence we're in
  35. if (F <= KF[1])               
  36.   define key 0
  37. if (F > KF[1] && F <= KF[2])
  38.   define key 1
  39. if (F > KF[2] && F <= KF[3])
  40.   define key 2
  41. if (F > KF[3] && F <= KF[4])
  42.   define key 3
  43. if (F > KF[4] && F <= KF[5])
  44.   define key 4
  45. if (F > KF[5] && F <= KF[6])
  46.   define key 5
  47. if (F > KF[6])
  48.   define key 6
  49.  
  50. // Calculate the value of "t" from the 
  51. // current frame and key frame sequence
  52. define F1 KF[key]
  53. define F2 KF[key + 1]
  54. define t  (F - F1) / (F2 - F1)
  55.  
  56. // Calculate the values of all object's location vectors
  57. define t3 t^3
  58. define t2 t^2
  59.  
  60. include "sphrcalc.inc"
  61.  
  62. // Now move the spheres to their new locations
  63. // Sphere1
  64. object {
  65.   sphere <0, 0, 0>, 0.5
  66.   reflective_red
  67.   translate <s1Px, s1Py, s1Pz>
  68. }
  69.  
  70. // Sphere2
  71. object {
  72.   sphere <0, 0, 0>, 0.5
  73.   reflective_blue
  74.   translate <s2Px, s2Py, s2Pz>
  75. }
  76.  
  77. // Sphere3
  78. object {
  79.   sphere <0, 0, 0>, 0.5
  80.   reflective_green
  81.   translate <s3Px, s3Py, s3Pz>
  82. }
  83.  
  84. include "camcalc.inc"
  85.  
  86. // Set up the camera
  87. viewpoint {
  88.   from            <camPx, camPy, camPz> 
  89.   at              <0, atPy, atPz>
  90.   up              <0, 1, 0>
  91.   angle           45
  92.   resolution      320,200
  93.   aspect          1.6
  94.   max_trace_depth 2
  95. }
  96.  
  97. include "spotcalc.inc"
  98.  
  99. define statue
  100. object {
  101.   object { 
  102.     venus 
  103.     rotate <-90, 0, 0>
  104.     translate <0, 0, 0>
  105.     rotate <0, 180, 0>
  106.     real_marble {scale <0.2, 0.2, 0.2>}
  107.     scale <0.5, 0.5, 0.5>
  108.   }
  109. +
  110.   object { 
  111.     pedestal
  112.     scale <3,4,3>  
  113.     rotate <0, 10, 0>
  114.     translate <0.1, -3.6, 0.25>
  115.     real_marble {scale <0.25, 0.25, 0.25>}
  116.   }
  117.   rotate <0, -45, 0>
  118.   translate <0, 0.5, 0>
  119. }
  120.  
  121. // The room, statue and paintings
  122. object {
  123.   object {
  124.     room2  
  125.   }
  126. +
  127.   object { statue }
  128. +
  129.   // picture1
  130.   object {
  131.     picture1
  132.     scale <0.125, 0.125, 0.125>
  133.     rotate <0, 90, 0>
  134.     translate <-9.95, 3.5, 0>
  135.   }
  136. +
  137.   // picture2
  138.   object {
  139.     picture2
  140.     scale <0.125, 0.125, 0.125>
  141.     //rotate <0, 90, 0>
  142.     translate <0, 3.5, 9.95>
  143.   }
  144. }
  145.